package dp.observer.weather.board;

import dp.observer.interfaces.Observer;
import dp.observer.interfaces.Subject;
import dp.observer.weather.WeatherDataCollector;

public class CurrentConditionBoard implements Observer {

	public CurrentConditionBoard(Subject subject)
	{
		subject.registerObserver(this);
	}
	
	public CurrentConditionBoard(){}
	
	public void update(Subject subject) {
		
		if(subject instanceof WeatherDataCollector)
		{
			WeatherDataCollector wdc = (WeatherDataCollector)subject;
			// --- 拉数据 ---
			float temprature = wdc.getTemprature();
			float humidity = wdc.getHumidity();
			float pressure= wdc.getPressure();
			
			System.out.println("Current Weather Condition:");
			System.out.println("temprature:" + temprature);
			System.out.println("humidity:" + humidity);
			System.out.println("pressure:" + pressure);
		}

	}

}
